{
	template:`
    <m-page>
        <div class="flex" style="margin-bottom:-180px;background-image:linear-gradient(#0081ff55, #0081ff00);">
            <div class="flex-sub"></div>
            <img style="width:200px;" src="resources/img/head.png"></img>
        </div>
        <div v-if="loginInfo.oid">
            <div class="flex padding-lr padding-bottom-sm align-center">
                <m-icon name="business"></m-icon>
                <div class="flex-sub padding-left-sm">
                    <div class="text-lg">{{loginInfo.business.name}}</div>
                    <div class="padding-top-xs text-sm text-grey">{{loginInfo.business.description}}</div>
                </div>
            </div>
            <div v-if="loginInfo.business.memberDayType!='N'" class="flex padding-lr padding-bottom-sm align-center">
                <div class="cu-tag radius bg-blue light">会员日</div>
                <div class="flex-sub padding-left-sm">
                    <div class="text-sm text-blue text-shadow">
                        <span v-if="loginInfo.business.memberDayType=='A'">{{dict('member.base.model.BusinessInfo!memberDayNo',loginInfo.business.memberDayNo)}}</span>
                        <span v-if="loginInfo.business.memberDayType=='B'">{{dict('member.base.model.BusinessInfo!memberWeekNo',loginInfo.business.memberWeekNo)}}</span>
                    </div>
                    <div class="padding-top-xs text-red">
                        <div class="cu-tag radius sm">积分{{loginInfo.business.pointRate}}%</div>
                        <div class="cu-tag radius sm">优惠{{loginInfo.business.discount}}%</div>
                    </div>
                </div>
            </div>
            <div class="padding-lr flex align-center">
                <div class="cu-avatar round bg-blue lg">{{loginInfo.realName.substring(0,1)}}</div>
                <div class="flex-sub padding-left-sm">
                    <div class="text-xl">你好！{{loginInfo.realName}}</div>
                    <span class="text-blue"><small>余额</small>{{formatAmount(loginInfo.balance)}}<small>元</small></span>
                    <span v-if="loginInfo.freeze" class="padding-left-sm text-orange"><small>（冻结中</small>{{formatAmount(loginInfo.freeze)}}<small>元）</small></span>
                </div>
                <div class="text-right">
                    <div class="cu-tag radius" :class="'bg-'+loginInfo.level.color">{{loginInfo.level.name}}</div>
                    <div :class="'text-'+loginInfo.level.color"><small>优惠</small>{{formatNum(loginInfo.level.discount)}}<small>%</small></div>
                </div>
            </div>
            <div class="padding-sm text-center">
                <m-grid :col="3">
                    <m-desc class="solid-right">
                        <template #title>
                            <div class="text-sm padding-bottom-xs">实际金额</div>
                        </template>
                        <div class="text-blue text-lg">{{formatAmount(loginInfo.realMoney)}}<small>元</small></div>
                    </m-desc>
                    <m-desc class="solid-right">
                        <template #title>
                            <div class="text-sm padding-bottom-xs">赠送金额</div>
                        </template>
                        <div class="text-blue text-lg">{{formatAmount(loginInfo.giveMoney)}}<small>元</small></div>
                    </m-desc>
                    <m-desc class="">
                        <template #title>
                            <div class="text-sm padding-bottom-xs">积分</div>
                        </template>
                        <div class="text-blue text-lg">{{formatNum(loginInfo.point)}}</div>
                    </m-desc>
                </m-grid>
            </div>
            <m-card color="blue" join light>
                <div class="flex align-center">
                    <div class="padding-lr text-center">
                        <m-icon name="wenjianzhengzhaoyinzhangwaijie"></m-icon>
                        <div>订单</div>
                    </div>
                    <div class="padding-xs flex-sub">
                        <m-grid :col="2">
                            <m-desc innerClass="bg-gray padding-lr-sm padding-tb-xs radius">
                                <template #title><div class="text-blue text-sm padding-bottom-xs">已完成</div></template>
                                <div class="text-right"><span class="text-blue text-lg padding-right-xs">{{formatNum(loginInfo.orderNum)}}</span><small>单</small></div>
                            </m-desc>
                            <m-desc innerClass="bg-gray padding-lr-sm padding-tb-xs radius">
                                <template #title><div class="text-blue text-sm padding-bottom-xs">累计金额</div></template>
                                <div class="text-right"><span class="text-blue text-lg padding-right-xs">{{formatAmount(loginInfo.useMoney)}}</span><small>元</small></div>
                            </m-desc>
                        </m-grid>
                    </div>
                </div>
            </m-card>
            <m-card join>
                <div class="grid col-3">
                    <div @click="openMemberPage('allServeGoodsList',{})" style="width:33.33%;">
                        <index-link icon="kucunpandian" title="服务价格" desc="服务商品价格"></index-link>
                    </div>
                    <div @click="openMemberPage('moneyRecordList',{})" style="width:33.33%;">
                        <index-link icon="gongzitiaoguanli" title="消费记录" desc="消费充值记录"></index-link>
                    </div>
                </div>
            </m-card>
            <m-title>登记中的订单
                <template #action><span class="text-blue" @click="openMemberPage('myOrderInfoList',{})">已完成订单>></span></template>
            </m-title>
            <m-top></m-top>
            <m-alert v-if="inputOrderList.length==0" icon="nodata" join>暂无登记中的订单</m-alert>
            <m-card v-for="item in inputOrderList" join>
                <div class="flex padding-sm align-center" @click="openMemberPage('orderInfo',{oid:item.oid})">
                    <div class="cu-tag radius" :class="'bg-'+item.inputStore.color">{{item.inputStore.name}}</div>
                    <div class="flex-sub padding-lr-sm">
                        <span class="padding-right-xs">{{item.orderNo}}</span>
                        <small>服务员工：</small>
                        <span class="padding-right-xs">{{item.serveUser.realName}}</span>
                        <div class="text-sm">[{{dict('member.order.model.OrderInfo!payType',item.payType)}}]实付{{formatAmount(item.payAmount)}}元</div>
                    </div>
                    <div class="text-right">
                        <status type="orderStatus" :value="item.status"></status>
                        <div class="text-sm padding-top-xs">{{formatDate(item.accountDate,'yyyy-MM-dd')}}</div>
                    </div>
                </div>
            </m-card>
            <m-title>登记中的充值
                <template #action><span class="text-blue" @click="openMemberPage('myMemberRechargeList',{})">已完成充值>></span></template>
            </m-title>
            <m-top></m-top>
            <m-alert v-if="inputRechargeList.length==0" icon="nodata" join>暂无登记中的充值</m-alert>
            <m-card v-for="item in inputRechargeList" join>
                <div class="flex padding-sm align-center" @click="openMemberPage('memberRecharge',{oid:item.oid})">
                    <div class="cu-tag radius" :class="'bg-'+item.inputStore.color">{{item.inputStore.name}}</div>
                    <div class="flex-sub padding-lr-sm">
                        <span class="padding-right-xs">{{item.orderNo}}</span>
                        <small>服务员工：</small>
                        <span class="padding-right-xs">{{item.serveUser.realName}}</span>
                        <div class="text-sm">
                            <span>[{{dict('member.order.model.MemberRecharge!type',item.type,'赊账')}}]付款{{formatAmount(item.payAmount)}}元</span>
                            <span v-if="item.giveAmount" class="padding-left-xs">赠送{{formatAmount(item.giveAmount)}}元</span>
                            <span v-if="item.givePoint" class="padding-left-xs">赠送{{formatNum(item.givePoint)}}积分</span>
                        </div>
                    </div>
                    <div class="text-right">
                        <status type="orderStatus" :value="item.status"></status>
                        <div class="text-sm padding-top-xs">{{formatDate(item.accountDate,'yyyy-MM-dd')}}</div>
                    </div>
                </div>
            </m-card>
        </div>

		<m-modal ref="loginModal" :drawer="false" title="登录信息" @close="loadLoginInfo(true)">
            <m-card color="blue" light>
                <div class="flex padding-sm align-center">
                    <m-icon name="business"></m-icon>
                    <div class="flex-sub padding-lr-sm">
                        <div class="text-lg">{{loginInfo.business.name}}</div>
                        <div class="padding-top-xs text-sm text-grey">{{loginInfo.business.description}}</div>
                    </div>
                </div>
            </m-card>
            <m-title>补全即可查询会员信息</m-title>
            <m-card>
                <div class="cu-form-group">
                    <div class="title text-red">姓名</div>
                    <m-input v-model="loginInfo.realName" placeholder="请输入姓名"></m-input>
                </div>
                <div class="cu-form-group">
                    <div class="title text-red">手机号</div>
                    <m-input v-model="loginInfo.phoneNum" placeholder="请输入手机号"></m-input>
                </div>
            </m-card>
            <div class="flex padding-lr-sm padding-bottom">
                <div class="flex-sub flex flex-direction padding-lr-xs">
                    <m-button @click="doLogin">登录</m-button>
                </div>
            </div>
		</m-modal>
    </m-page>
	`,
	props: ['param','parentVue'],
	data:function(){
		return {
		    loginInfo:{business:{},level:{}},
		    page:'',
		    params:{},
		    inputOrderList:[],
		    inputRechargeList:[]
		};
	},
	mounted(){
	    this.loadLoginInfo(false);
	    this.page=this.param.page||'';
	    this.params=this.param.param||{};
	},
	methods:{
	    loadLoginInfo:function(remind){
            this.requestData('action/member/memberInfo/loginInfo',
                {oid:this.param.oid},
                (data)=>{
                    if(data.code==0){
                        this.loginInfo=data.login;
                        if(this.loginInfo.oid){
                            document.title=this.loginInfo.business.name;
                            //有登录信息
                            console.log(this.page,this.params);
                            if(this.page){
                                this.openMemberPage(this.page,this.params,this.initMain);
                            }else{
                                this.initMain();
                            }
                        }else{
                            if(remind) this.remind().warn("登录后才能查询会员信息");
                            this.$refs.loginModal.open();
                        }
                    }else{
                        this.remind().error(data.msg);
                    }
                }
            );
	    },
	    doLogin:function(){
            this.requestData('action/member/memberInfo/doLogin',
                {login:this.loginInfo},
                (data)=>{
                    if(data.code==0){
                        this.$refs.loginModal.close();
                    }else{
                        this.remind().error(data.msg);
                    }
                }
            );
	    },
	    openMemberPage:function(page,params,fn){
            this.openPage('member/'+page+'.js',params,fn);
	    },
	    initMain:function(){
            this.requestData('action/member/orderInfo/getMyList',
                {params:{'status@ne':'Y'}},
                (data)=>{
                    if(data.code==0){
                        this.inputOrderList=data.page.list;
                    }else{
                        this.remind().error(data.msg);
                    }
                }
            );
            this.requestData('action/member/memberRecharge/getMyList',
                {params:{'status@ne':'Y'}},
                (data)=>{
                    if(data.code==0){
                        this.inputRechargeList=data.page.list;
                    }else{
                        this.remind().error(data.msg);
                    }
                }
            );
	    }
	}
}